package org;

import org.entities.LevelObject;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.Color;
import org.newdawn.slick.Input;
import org.newdawn.slick.Image;
//import org.newdawn.slick.Animation;
//import org.newdawn.slick.SpriteSheet;
//import org.newdawn.slick.state.transition.FadeInTransition;
//import org.newdawn.slick.state.transition.FadeOutTransition;
//import java.util.ArrayList;
import org.newdawn.slick.AngelCodeFont;
//import org.newdawn.slick.Color;
import org.newdawn.slick.Font;

public class GameOver  extends BasicGameState 
{

    private StateBasedGame game;
    private Image logo,titlebg;
    private Image screen;
    private Font font;
    public static final int ID = 3;

    public int getID()
    {
        return ID;
    }

    public void init(GameContainer container, StateBasedGame game) throws SlickException 
    {
        this.game = game;		
        titlebg = new Image("data/image/titlebg.jpg");
        logo = new Image("data/image/sweaselLogo.png");
        screen = new Image("data/image/ctrlScreen3.png");
        //screen = new Image("data/image/ctrlScreen.png");
        font = new AngelCodeFont("data/font/weasel.fnt","data/font/weasel.png");
    }

    public void update(GameContainer container, StateBasedGame game, int delta){}

    public int getDelta(int delta)
    {
        return delta;
    }

    public void render(GameContainer container, StateBasedGame game, Graphics g)
    {
        if (!LevelObject.debugMode)
        g.scale(2f, 2f);
        g.drawImage(titlebg,0,0);
        g.drawImage(logo,200-(logo.getWidth()/2),50-(logo.getHeight()/2));
        g.drawImage(screen, 88, 112);
        g.setFont(font);
        g.setColor(Color.white);
        g.drawString("G A M E    O V E R", 135, 130);
        g.resetTransform();
        g.drawString("Y : Try again ?", 270, 360);
        g.drawString("N : Quit game", 270, 385);
    }
    
    public void keyReleased(int key, char c)
    {
        if (key == Input.KEY_Y)
        {			
            GameState.bmap = null;                
            GameState.restartGame = true;            
            Progress.shields =30;
            Progress.health =90;
            Progress.energy =80;
            Progress.strength =100;
            game.enterState(Transition.ID, null, null);	
        }
        if (key == Input.KEY_N) 
        {
            System.exit(0);
        }
    }
}
